home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 16 / PC Actual CD 16.iso / cdactual / Os2 / 0509 / SimpleStream.java < prev    next >
Encoding:
Java Source  |  1997-08-19  |  891 b   |  42 lines

  1. package macrolanguage;
  2. import java.io.OutputStream;
  3. import java.util.Vector;
  4.  
  5. /**
  6.  * The SimpleStream class implements OutputStream and simply stores all that
  7.  * is written to the output stream. Its purpose is to allow programs who
  8.  * only use text streams to implement the stream in a simple way.
  9. **/
  10. public class SimpleStream extends java.io.OutputStream
  11. {
  12.   public void write(int i)
  13.   {
  14.     stringsWritten.addElement(Integer.toString(i));
  15.   }
  16.  
  17.   public void write(byte[] data)
  18.   {
  19.     stringsWritten.addElement(new String(data));
  20.   }
  21.  
  22.   public void write(byte[] data, int start, int offset)
  23.   {
  24.     stringsWritten.addElement(new String(data,start,offset));
  25.   }
  26.  
  27.   public void flush()
  28.   {
  29.   }
  30.  
  31.   public void close()
  32.   {
  33.   }
  34.  
  35.   public Vector getStringsWritten()
  36.   {
  37.     return(stringsWritten);
  38.   }
  39.  
  40.   private Vector stringsWritten = new Vector();
  41. }
  42.